package com.my;

/**
 * Created by yijy on 2018/3/7.
 * 1.put和get方法
 * 2.用数组和链表的形式存储值
 * 3.满足key和value可以存储空值
 */
public class MyHashMap<K,V> {

    public void put(Object key, Object value){
        putVal(10,key,value);
    }

    private final static int default_init_cap = 1 << 4;

    private final static float load_factor = 0.75f;

    private  Node<K,V>[] table = new Node[default_init_cap];

    private static int size;

    public void putVal(int index,Object key, Object value){
        K k = (K) key;
        V val = (V) value;
        Node<K,V> nowNode = new Node(index,k,val,null);
        table[table.length] = nowNode;
    }

    private class Node<K,V>{
        final int index;
        final K key;
        V value;
        Node<K,V> node;

        public Node(int index, K key, V value, Node<K, V> node) {
            this.index = index;
            this.key = key;
            this.value = value;
            this.node = node;
        }

        public int getIndex() {
            return index;
        }

        public Node<K, V> getNode() {
            return node;
        }

        public void setNode(Node<K, V> node) {
            this.node = node;
        }
    }

}
